<template>
  <div>
    <el-tabs  v-model="activeName" type="border-card"  @tab-click="tabclick">
      <el-tab-pane name="one" label="参与的服务">
          <userCourse ref="userCourse"></userCourse>
      </el-tab-pane>
      <el-tab-pane class="recordHight"  name="two" label="积分记录">
          <userIntegral ref="userIntegral"></userIntegral>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
  import userCourse from "./detailMsg/userCourse.vue"
  import userIntegral from "./detailMsg/userIntegral.vue"
  export default {
    data() {
      return {
        activeName:"one"
      }
    },
    components: {
      userCourse,
      userIntegral
    },
    mounted() {
     let getActiveName = window.localStorage.getItem("activeName")
      if(getActiveName != undefined){
         this.activeName = getActiveName
      }
    },
    methods: {
        tabclick(e){
            if(e.index==0){
              this.$refs.userCourse.getUserBuyCourseList();
            } else if(e.index==1){
              this.$refs.userIntegral.getIntegralRecordList()
            }
            window.localStorage.setItem("activeName",this.activeName)
        }

    }
  }
</script>
<style scoped="scoped">
   .recordHight{
      margin-bottom: 30px;
    }
</style>
